// pages/tabBar/my/component/Information/updateInfo/updateInfo.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
      param:"",   //传来的参数
      disable:null //按钮是否可用
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      const type = options.type
      if(type === 'name'){
        wx.setNavigationBarTitle({
          title: '修改昵称',
        })
        this.setData({
          ...this.data,
          param:options.param
        })
      }else{
        wx.setNavigationBarTitle({
          title: '修改绑定手机',
        })
        this.setData({
          ...this.data,
          param:options.param
        })
      }
      if(options.param === ""){
        this.setData({
          ...this.data,
          disable:true
        })
      }
  },

  /**
   * 清除按钮
   */
  clear:function(){
    this.setData({
      param:"",
      disable:true
    })
  },
  /**
   * 键盘输入事件
   */
  input:function(e){
    this.setData({
      ...this.data,
      param: e.detail.value
    })
    if(this.data.param.length >= 1){
      this.setData({
        ...this.data,
        disable:false
      })
    }else{
      this.setData({
        ...this.data,
        disable:true
      })
    }
  },
  
})